package com.hao.wms.query;

import com.hao.wms.util.DateUtil;

import java.util.Date;

public class StockIncomeBillQueryObject extends QueryObject {
	private Date beginDate;
	private Date endDate;
	private Long depotId = -1L;
	private int status = -1;

	public Date getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Long getDepotId() {
		return depotId;
	}

	public void setDepotId(Long depotId) {
		this.depotId = depotId;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@Override
	public void customerQuery() {
		if (beginDate != null) {
			addQuery("obj.vdate >= ?", DateUtil.getBeginDate(beginDate));
		}
		if (endDate != null) {
			addQuery("obj.vdate <= ?", DateUtil.getEndDate(endDate));
		}
		if (depotId > 0) {
			addQuery("obj.depot.id = ?", depotId);
		}
		if (status >= 0) {
			addQuery("obj.status = ?", status);
		}
	}

}
